<!DOCTYPE html>
<head xmlns:v-bind="http://www.w3.org/1999/xhtml" >
    <meta charset="UTF-8">
    <title>demo14-vue自定义指令</title>
  <script src="./js/vue.min.js"></script>

</head>

<body>
   <div id="app">
     <p>页面载入时，input元素自动获取焦点：</p>
     <input v-focus>
   </div>

</body>

<script type="application/javascript">
  //注册
  Vue.directive('focus',{
    inserted: function (el) {
      //聚焦元素
      el.focus();
    }
  });
  new Vue({
    el: "#app"
  })


</script>
</html>
